<%@ include file="include.jsp"%>
<body>
	<h1>Create summary</h1>
	<form:form id="save_summary" action="/summary/save_summary"
		method="post" modelAttribute="summary">
		<form:hidden path="id" />
		<table>
			<tr>
				<td><form:label id="titleLabel" path="title">Title : </form:label></td>
				<td><form:input id="title" path="title" /></td>
			</tr>

			<tr>
				<td><form:label id="urlLabel" path="url">Url : </form:label></td>
				<td><form:input id="url" path="url" /></td>
			</tr>
			<tr>
				<td><form:label id="ownerSummaryLabel" path="owner">Owner Summary : </form:label></td>
				<td><form:select path="owner">
						<form:option value="-" label="--Please Select" />
						<form:options items="${ownerSummary}" itemValue="id" itemLabel="title"/>
					</form:select></td>
			</tr>
		</table>
		<p id="error"></p>
		<input type="button" value="Save" onclick="checkValuesBeforeSubmit()" />
		<input type="reset" value="Cancel" />
	</form:form>
</body>

<script type="text/javascript">
	function checkValuesBeforeSubmit() {
		var isOk = true;
		if (isOk) {
			document.forms["save_summary"].submit();
		} else {
			document.getElementById("error").innerHTML = "You must fill in all this attributes with (*)";
		}
	}
</script>
</html>